class BlueMarble:
    turn = 0
    card_map = {0:"이동 9", 1:"매각", 2:"구입", 3:"무인도", 4:"출발", 5:"우주여행", 6:"이동 5", 7:"세금", 8:"황금열쇠", 9:"황금열쇠"}
    building_map = {'런던':{'owner':-1, 'buy':500, 'tax':-800, 'sale':300}, '뉴욕':{'owner':-1, 'buy':600, 'tax':-900, 'sale':400}, '파리':{'owner':-1, 'buy':700, 'tax':-1000, 'sale':500},
                    '로마':{'owner':-1, 'buy':800, 'tax':-1100, 'sale':600}, '마드리드':{'owner':-1, 'buy':300, 'tax':-600, 'sale':200}, '리스본':{'owner':-1, 'buy':400, 'tax':-700, 'sale':300},
                    '부산':{'owner':-1, 'buy':1000, 'tax':-1500, 'sale':400}, '상파울루':{'owner':-1, 'buy':500, 'tax':-800, 'sale':300}, '시드니':{'owner':-1, 'buy':600, 'tax':-900, 'sale':400},
                    '몬트리올':{'owner':-1, 'buy':500, 'tax':-800, 'sale':300}, '베를린':{'owner':-1, 'buy':600, 'tax':-900, 'sale':300}, '코펜하겐':{'owner':-1, 'buy':200, 'tax':-400, 'sale':100},
                    '뮌헨':{'owner':-1, 'buy':300, 'tax':-500, 'sale':100}, '홍교수님':{'owner':-1}, '이스탄불':{'owner':-1, 'buy':500, 'tax':-800, 'sale':300}, '카이로':{'owner':-1, 'buy':500, 'tax':-800, 'sale':300},
                    '제주도':{'owner':-1, 'buy':1500, 'tax':-2000, 'sale':600}, '홍콩':{'owner':-1, 'buy':100, 'tax':300, 'sale':-50}, '마닐라':{'owner':-1, 'buy':500, 'tax':800, 'sale':300}}

    game_map = {0:{0:0, 1:0, 'event':'출발'}, 1:{0:0, 1:0, 'event':'런던'}, 2:{0:0, 1:0, 'event':'뉴욕'}, 3:{0:0, 1:0, 'event':'황금열쇠'}, 4:{0:0, 1:0, 'event':'파리'}, 5:{0:0, 1:0, 'event':'로마'},
                6:{0:0, 1:0, 'event':'무인도'}, 7:{0:0, 1:0, 'event':'마드리드'}, 8:{0:0, 1:0, 'event':'리스본'}, 9:{0:0, 1:0, 'event':'부산'}, 10:{0:0, 1:0, 'event':'상파울루'}, 11:{0:0, 1:0, 'event':'시드니'},
                12:{0:0, 1:0, 'event':'우주여행'}, 13:{0:0, 1:0, 'event':'몬트리올'}, 14:{0:0, 1:0, 'event':'베를린'}, 15:{0:0, 1:0, 'event':'황금열쇠'}, 16:{0:0, 1:0, 'event':'코펜하겐'}, 17:{0:0, 1:0, 'event':'뮌헨'},
                18:{0:0, 1:0, 'event':'홍교수님'}, 19:{0:0, 1:0, 'event':'이스탄불'}, 20:{0:0, 1:0, 'event':'카이로'}, 21:{0:0, 1:0, 'event':'제주도'}, 22:{0:0, 1:0, 'event':'홍콩'}, 23:{0:0, 1:0, 'event':'마닐라'}}

    def setUserLocation(self, user_id, prev_location, next_location):
        if prev_location + next_location >= 24:
            self.game_map[prev_location][user_id] = 0
            self.game_map[prev_location+next_location-24][user_id] = 1
        else:
            self.game_map[prev_location][user_id] = 0
            self.game_map[prev_location + next_location][user_id] = 1

    def getUserLocation(self, user_id):
        for i in range(0, 23):
            if self.game_map[i][user_id] == 1:
                return i
        return 0

    def checkEvent(self, user_id, location):
        if self.game_map[location]['event'] == '출발':
            return 10000
        elif self.game_map[location]['event'] == '무인도':
            return 999
        elif self.game_map[location]['event'] == '황금열쇠':
            return 777
        elif self.game_map[location]['event'] == '홍교수님':
            return 7
        elif self.game_map[location]['event'] == '우주여행':
            return 6
        else:
            location_owner = self.building_map[self.game_map[location]['event']]['owner']
            if location_owner == user_id:
                return 0
            elif location_owner == -1:
                return self.building_map[self.game_map[location]['event']]['buy']
            else:
                return self.building_map[self.game_map[location]['event']]['tax']

    def getLocationName(self, location):
        return self.game_map[location]['event']

    def setBuildingOwner(self, user_id, building):
        self.building_map[building]['owner'] = user_id

    def __init__(self):
        pass

if __name__ == "__main__":
    pass